﻿/*******************************************************/
/*               请根据网站不同修改此文件              */
/*******************************************************/

//唯一的配置变量,定义在jquery下面 提高性能
//Config.js 是组件的初始化外部接口
//告诉你个秘密 不要告诉别人啊 config.js 不仅可以定义常量，而且变量，函数值什么的都可以了，总之可以旋转的啦
$.CONFIG = {
	//系统配置项
	server : "http://localhost:8080/gd_gdxt/gd_be",
	userHost:"http://localhost:8080/gd_gdxt/gd_uc/home.html",
	indexpage : "overview",
	tmplTarget : ".content",
	//是否开启Map模式
	addrMap : true,
	//Loadbar 默认配置
	Loadbar  : {
		width	:	"200px",
		height	:	"10px",
		speed	:	"normal",
		auto	:	false
	},
	//MenuView 默认配置
	MenuView : {
		open : true,
		type : "menu",
		index: "/Info/overview/"
	},
	//Dropdown 默认配置
	Dropdown : {
		enable : true
	},
	//Dialog 默认配置
	Dialog   : {
		moveable : true
	},
	//Actionbar 默认配置项
	Actionbar : {
		itemArr : {
			
			"help" : {
				icon : "fa-question-circle", 
				text : "帮助",
				content : "帮助说明",
				enable : true
			},
			"user" : {
				icon : "fa fa-user",
				text : "",
				content : "",
				enable : true
			}
		
		}
	},
	//popbox 默认值
	Popbox : {
		isOpen : false
	},
	//Tooltip 默认值
	Tooltip : {
		placement : "top",
		open : true
	},
	//Tabs 默认值
	Tabs : {
		index : 0
	},
	//BreadCrumb 默认值
	BreadCrumb :{
		area: "广电中心",
		areaColor : "gd",
		areaUrl : "#",
		areaPath : "/",

		index :{ 
			"1":{
				text : "总览",
				path : "/overview/",
				url : "#"
			}
		}
	},
	Toast :{
		statType :["default","success", "error"],
		defaultType :"default",
		animTime :600,
		delay :1500
	},
	Seekbar : {
		min : 0,
		max : 10,
		value : 5,
		step : 1,
		style : 'horizontal'
	},
	UrlMap :{
		overview:"/api/index/info-loc.json",
		Index:{
			menu:"/api/index/menu.php",
			log:"",
			User:"/api/index/user.php",
			logout:""
		},
		WorkOrder : {
			overview:"/api/index/workorder.php?action=orderList",
			detail:"/api/index/workorder.php",
			route:"/api/index/workorder.php",
			handle:"/api/index/workorder.php?action=update2",
			alarminput:"/api/index/workorder.php?action=lineRegion",
			alarmadd:"/api/index/workorder.php?action=CreateWarning",
			//create:"/api/index/lineinfo.json",
			create : "/api/index/workorder.php?action=initWorkOrder",
			add : "/api/index/workorder.php?action=create2",
			edit : "",
			noticeinput:"",
			addnotice:"/api/index/workorder.php?action=addnotice",
			comment:"/api/index/workorder.php",
			commentInfo:"/api/index/workorder.php",
			del : "/ip-delete.json",
			handlerlist:"/api/index/workorder.php?action=handlerList",
			workorderdispatch:"/api/index/workorder.php?action=workorderDispatch",
			workorderreturn:"/api/index/workorder.php?action=workorderReturn"
		},
		Info : {
			overview :"",
			userview : "/api/index/info-loc.json",
			userinfo : "/api/index/clientlist.php",
			userinfo_detail : "/api/index/user.php",
			myinfo : "/api/index/workorder.php?action=initInfocreate",
			lineList: "/api/index/workorder.php",
			listworkorder:"/api/index/workorder.php",		
			detail:"/api/index/workorder.php",
			route:"/api/index/workorder.php",
			linedetail:"/api/index/workorder.php?action=lineDetail",
			userinfocreate:"/api/index/workorder.php?action=initInfocreate",
			update:"/api/index/workorder.php?action=updateInfo"
		},
		Line:{
			overview:"",
			lineview:{
					overview:"/api/index/workorder.php?action=lineList",
					createworkorder:"/api/index/workorder.php",
					detail:"/api/index/workorder.php?action=lineDetail",
					listworkorder:{
						overview:"/api/index/workorder.php?action=orderListByLineId",
						route:"/api/index/workorder.php",
						detailworkorder:"/api/index/workorder.php",
					}
			},	
			linerank:"/api/index/workorder.php?action=lineRanking",
			topoElectric:"/api/index/workorder.php?action=imageList&type=topoElectric",
			topoGeography:"/api/index/workorder.php?action=imageList&type=topoGeography",
			srcWorksheet:"/api/index/workorder.php?action=imageList&type=srcWorksheet",
			serviceRoute:"/api/index/workorder.php?action=imageList&type=serviceRoute",
			networkperformance:"/api/index/workorder.php?action=networkPerformance",
			ipperformance:"/api/index/workorder.php?action=ipPerformance",
			comment:"/api/index/workorder.php",
			commentView:"/api/index/workorder.php",
			comment_submit:"/api/index/workorder.php?action=commentSubmit",
			create:"/api/index/workorder.php?action=initLinecreate",
			add:"/api/index/workorder.php?action=createline",
			addresource:"",
			resourceadd:"/api/index/workorder.php?action=addresource",
			IPpfrmcInput:"/api/index/workorder.php?action=lineRegion",
			IPpfrmcAdd:"/api/index/workorder.php?action=IPpfrmcAdd",
			ntwrkInput:"/api/index/workorder.php?action=lineRegion",
			ntwrkAdd:"/api/index/workorder.php?action=ntwrkAdd",
			trfcwrInput:"/api/index/workorder.php?action=lineRegion",
			trfcwrAdd:"/api/index/workorder.php?action=trfcwrAdd",
			ipperformance_delete:"/api/index/workorder.php?action=ipperformanceDelete",
			networkperformancedelete:"/api/index/workorder.php?action=networkperformancedelete",
			topologymanage:{ 
				overview:"/api/index/workorder.php?action=topologyManage",
				imagemanage:"/api/index/workorder.php?action=imageManage",
			},			
			deleteimage:"/api/index/workorder.php?action=deleteImage",
			imagesort:	"/api/index/workorder.php?action=imageSort",
			workordercancel:"/api/index/workorder.php?action=workorderCancel"

		},
		View:{
			alarmview:"/api/index/workorder.php?action=warningList",
			alarmview_detail:"/api/index/workorder.php?action=warningDetail",
			alarmview_delete:"/api/index/workorder.php?action=warningDelete",
			noticeview:{
				overview : "/api/index/workorder.php?action=noticeList",
				detail:"/api/index/workorder.php"
			},
			noticeview_delete:"/api/index/workorder.php?action=noticeviewDelete",
			warningrank:"/api/index/workorder.php?action=lineWarningRank",
			warninglevelrank:"/api/index/workorder.php?action=warningLevelRank",
			traffic:"/api/index/workorder.php?action=traffic",
			traffic_delete:"/api/index/workorder.php?action=trafficDelete",
			clientList:"/api/index/workorder.php?action=getClientList",
			clientList_detail:"/api/index/workorder.php?action=clientDetail"
		},
		Department:{
			adddep:"",
			newdep:"/api/index/workorder.php?action=adddep",
			adduser:"/api/index/workorder.php?action=warningList",
			deldep:"/api/index/workorder.php?action=deldep",
			deluser:"/api/index/workorder.php",
			detail:"/api/index/workorder.php?action=depDetail",
			overview:"/api/index/workorder.php?action=depList"
		},
		Role:{
			overview:"",
			rolelist:"/api/index/role.php?action=roleList",
			authorization:"/api/index/role.php",
			save:"/api/index/role.php?action=save",
			newrole:"",
			addrole:"/api/index/role.php?action=addRole",
			deleterole:"/api/index/role.php",
			userrole:"/api/index/role.php?action=userRole",
			userlist:"/api/index/role.php?action=userList",
			changerole:"/api/index/role.php?action=changeRole"
		}
	}
};

//获取模板 不同网站/不同插件 获取模板的方式不一样
$.CONFIG.getTMPL = function (tmplid) {
	console.log(tmplid);
	if( QTMPL &&  QTMPL[tmplid] ){
		var tmpl = Handlebars.compile(QTMPL[tmplid]);
		return tmpl;
	}
	return $('#' + tmplid).html();
}
$.CONFIG.getFdata = function (fdata) {
	if( !fdata )
		return {};
	if( typeof fdata == "object")
		return fdata;
	var paramArr = fdata.split("&")
		data = new Object()
		;
	for (var key in paramArr){
		var key_value = paramArr[key].split("=");
		data[key_value[0]] = key_value[1];
	}
	return data;
}
